#include <stdio.h>

#include "utringbuffer.h"

typedef struct {
	int a;
	int b;
} intpair_t;

UT_icd intpair_icd = {sizeof(intpair_t), NULL, NULL, NULL};

int main(){
	intpair_t ip, *p;
	UT_ringbuffer *pairs;

	utringbuffer_new(pairs, 7, &intpair_icd);

	ip.a = 1;  ip.b = 2;  utringbuffer_push_back(pairs, &ip);
	ip.a = 10; ip.b = 20; utringbuffer_push_back(pairs, &ip);

	for(p = (intpair_t *)utringbuffer_front(pairs);
		p != NULL;
		p = (intpair_t *)utringbuffer_next(pairs, p))
		printf("%d %d\n", p->a, p->b);

	utringbuffer_free(pairs);

	return 0;
}

